{% extends "base.volt" %}
{% block pageHeader %}
        {{ stylesheet_link("/assets/manage/css/info.css", false) }}
{% endblock %}
{% block pageFooter%}
{{ javascript_include("/assets/manage/js/question/info.js", false) }}
{% endblock %}

{% block content %}
    {{ partial("module/left_question") }}
    <div class="col-xs-10">
        <ol class="breadcrumb">
            <li>问答管理</li>
            <li class="active">问题详情</li>
        </ol>
           <div class="question">
            	<p>提问者</p>
            	<div class="question_info">
            		<div class="user_info">
            			<img style="width:100px; height:100px;border-radius: 50%;border: 1px solid #ddd;" src="{{ questioninfo.user_cover }}" />
            			<span >{{ questioninfo.user_nickname }}</span>
            		</div>
            		<div class="question_content">
            			<span>{{ questioninfo.question_content }}</span>
            			{% for r in questioninfo.question_pics %}
            				<a class="thumbnail inBlock" href="http://img.meelier.com/{{ r }}" target="_blank"><img style="width:100px; height:100px;" src="http://img.meelier.com/{{ r }}" /></a>
            			{% endfor %}
						<p>
							<label>阅读量：{{questioninfo.question_browsers}}</label>
							<label>评论：{{comment_count}}</label>
							<span class="time" style="display: inline;">{{ questioninfo.question_addtime }}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:void(0);" class="reply" duser="楼主" duid="{{ questioninfo.user_id }}" drole="1" type="1" >回复TA</a></span>

						</p>
						<div>
							<p>美人儿已阅。.。</p>
							<div>
								{% for r in seelist %}
								<img src="http://img.meelier.com/{{ r.user_cover }}" style="width:50px;height:50px;" alt="用户头像"/>
								{% endfor %}
							</div>
						</div>
            		</div>
            		<div class="clear"></div>
            	</div>
            	<div style="width:100%; height:30px;"></div>
            	<p>专家回复</p>
            	{% for r in answerlist %}
            	{% if r['type']==2 %}
            	<div class="question_info" style="margin-top:20px;border-bottom: 1px solid #ddd;">
            		<div class="user_info">
            			<img style="width:100px; height:100px;border-radius: 50%;border: 1px solid #ddd;" src="{{ r['user_cover'] }}" />
            			<span >{{ r['user_nickname'] }}</span>
            		</div>
            		<div class="question_content">
						<div>

							<span>{{ r['answer_content'] }}</span>
							{% if count(r['answer_pics']) > 0 %}
							{% for v in r['answer_pics'] %}
							<a class="thumbnail inBlock" href="http://img.meelier.com/{{ v }}" target="_blank"><img style="width:100px; height:100px;" src="http://img.meelier.com/{{ v }}" /></a>
							{% endfor %}
							{% endif %}
							<span class="time">{{ r['answer_addtime'] }}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:void(0);" durl="{{url.get('questionmanage/deleteanswer')}}?id={{r['answer_id']}}" class="answer_del">删除</a>&nbsp;&nbsp;&nbsp;<!--<a href="javascript:void(0);" class="reply" duser="{{ r['user_nickname'] }}" duid="{{ r['user_id'] }}" danswer="{{ r['answer_id'] }}" type="3">回复TA</a>--></span>
                            <a href="javascript:void(0);" class="reply" duser="专家" duid="{{ r['user_id'] }}" danswer="{{ r['answer_id'] }}" type="5" >回复专家</a>
						</div>
						{% if count(r['reply']) > 0 %}
            			{% for v in r['reply'] %}
            			{% if r['user_id'] == v['user_id'] %}
						<div>
							<p><em>专家</em><label>回复：</label></p>
							<span>{{v['content']}}</span>
							<div>
								<label>{{v['add_time']}}</label>
								<a href="javascript:void(0);" durl="{{ url.get('questionmanage/del') }}?id={{v['id']}}&qid={{questioninfo.question_id}}" class="answer_dels">删除</a>
                                <a href="javascript:void(0);" class="reply" duser="专家" duid="{{ v['user_id'] }}" danswer="{{ r['answer_id'] }}" type="5" >回复专家</a>
							</div>
						</div>
                        -------------------------------------------------------------------
						{% else %}
						<div>
							<p><em>楼主</em><label>回复：</label><em></em></p>
							<span>{{v['content']}}</span>
							<div>
								<label>{{v['add_time']}}</label>
                                <a href="javascript:void(0);" durl="{{ url.get('questionmanage/del') }}?id={{v['id']}}&qid={{questioninfo.question_id}}" class="answer_dels">删除</a>
                                <a href="javascript:void(0);" class="reply" duser="楼主" duid="{{ v['user_id'] }}" danswer="{{ r['answer_id'] }}" type="6" >回复楼主</a>
							</div>
						</div>
                        -------------------------------------------------------------------
						{% endif %}
						{% endfor %}
            		{% endif %}
                        <br>
            		</div>
            		
            		<div class="clear"></div>
            	</div>
            	{% endif %}
            	{% endfor %}
            	<div style="width:100%; height:30px;"></div>
            	<p>网友回复</p>
            	{% for r in answerlist %}
            	{% if r['type']==1 %}
            	<div class="question_info" style="margin-top:20px;border-bottom: 1px solid #ddd;">
            		<div class="user_info">
            			<img style="width:100px; height:100px;border-radius: 50%;border: 1px solid #ddd;" src="{{ r['user_cover'] }}" />
            			<span >{{ r['user_nickname'] }}</span>
            		</div>
            		<div class="question_content">
            			{% if r['original_content'] %}
            				<span style="padding:10px; background:#eee;">引用：{{ r['original_content'] }}</span>
            			{% endif %}
            			<span>{{ r['answer_content'] }}</span>
            			{% if count(r['answer_pics']) > 0 %}
            				{% for v in r['answer_pics'] %}
            					<a class="thumbnail inBlock" href="http://img.meelier.com/{{ v }}" target="_blank"><img style="width:100px; height:100px;" src="http://img.meelier.com/{{ v }}" /></a>
            				{% endfor %}
            			{% endif %}
            			<span class="time">{{ r['answer_addtime'] }}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:void(0);" durl="{{url.get('questionmanage/deleteanswer')}}?id={{r['answer_id']}}" class="answer_del">删除</a>&nbsp;&nbsp;&nbsp;<a href="javascript:void(0);" class="reply" duser="{{ r['user_nickname'] }}" duid="{{ r['user_id'] }}" danswer="{{ r['answer_id'] }}" type="3">回复TA</a></span>
            		</div>
            		<div class="clear"></div>
            	</div>
            	{% endif %}
            	{% endfor %}
           </div>
            
            <form id="form_add" class="form-horizontal" style="margin-top:30px;" role="form" method="post" action="{{url.get('questionmanage/addanswer')}}" urlList="{{url.get('questionmanage/info')}}?id={{question_id}}" target="ifr_send_file" enctype="multipart/form-data">
            <div class="form-group">
                <label for="question_browsers" style="width:120px; text-align:left; margin-left:20px;" class="col-xs-2 control-label">回复<span id="role">楼主</span></label>
                <input type="hidden" name="type" value="1" id="type"/>
                <input type="hidden" name="answer" value="" id="answer">
                <input type="hidden" name="question_id" value="{{ question_id }}">
                <input type="hidden" name="to_user_id" value="" />
                <div class="col-xs-9">
                    <textarea class="form-control" style="height:120px;" name="content"></textarea>
                </div>
            </div>
            <div id="picGroup" class="form-group">
                <label for="question_browsers" class="col-xs-2 control-label" style="width:120px; text-align:left; margin-left:20px;">图片</label>
                <div class="col-xs-9">
                    <div id="bp_photos_box">
	                    <div class="input-group paddingTB5">
	                        <input type="file" class="form-control" name="a_photos[]">
	                        <div class="input-group-addon bg_red cursor_pointer" onclick="$.bpPhotoDel(this)"><i class="fa fa-times"></i></div>
	                    </div>
	                    <div class="input-group paddingTB5">
	                        <input type="file" class="form-control" name="a_photos[]">
	                        <div class="input-group-addon bg_red cursor_pointer" onclick="$.bpPhotoDel(this)"><i class="fa fa-times"></i></div>
	                    </div>
	                    <div class="input-group paddingTB5">
	                        <input type="file" class="form-control" name="a_photos[]">
	                        <div class="input-group-addon bg_red cursor_pointer" onclick="$.bpPhotoDel(this)"><i class="fa fa-times"></i></div>
	                    </div>
                	</div>
                	
                </div>
            </div>
                <div class="form-group">
                    <label for="activity_cover" class="col-xs-2 control-label" style="width:120px; text-align:left; margin-left:20px;">搜索提问者</label>
                    <div class="col-xs-9">
                        <input type="text" class="form-control" name="search_user" >
                    </div>
                </div>
            <div class="form-group">
                <label for="question_browsers" style="width:120px; text-align:left; margin-left:20px;" class="col-xs-2 control-label">用户</label>
                <div class="col-xs-9">
                    <select name="user_id" class="form-control">
                    	{% for r in userlist %}
                    		<option value="{{ r.user_id }}">{{ r.user_nickname }}</option>
                    	{% endfor %}
                    </select>
                </div>
            </div>
            <div class="form-group">
                <div class="col-xs-12 text-center">
                    <button id="btn_save" type="submit" class="btn btn-primary"><i class="fa fa-floppy-o fa-lg"></i> 保 存</button>
                </div>
            </div>
            </form>

    </div>
    
    
    
{% endblock %}